import React, { Component } from 'react'
import axiso from 'axios'

export default class App extends Component {

  getStudentsDate =()=>{
    axiso.get('/api1/students').then(
      response =>{console.log('成功',response.data)},
      error =>{console.log('失败',error)}
    )
  }

  getCarsDate = () => {
    axiso.get('http://localhost:3000/api2/cars').then(
      response =>{console.log('成功',response.data)},
      error =>{console.log('失败',error)}
    )
  }

  render() {
    return (
      <div>
        <button onClick={this.getStudentsDate}>获取学生数据</button>
        <button onClick={this.getCarsDate}>获取汽车数据</button>
      </div>
    )
  }
}
